<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Java Service Wrapper - Environment Variables</title>
<style media="all" type="text/css">
            @import url("./style/wrapper.css");
        </style>
</head>
<body bgcolor="#eeeeff" marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" alink="#023264" vlink="#023264" link="#525D76" text="#000000">
<map name="wrapperLogo">
<area href="http://wrapper.tanukisoftware.org" coords="90,90,88" shape="circle">
</map>
<map name="wrapperTitle">
<area href="http://www.tanukisoftware.com" coords="28,32,176,48" shape="rect">
</map>
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
<td valign="top" width="180">
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
<td width="180"><img usemap="#wrapperLogo" border="0" height="180" width="180" src="images/WrapperLogo.png"></td>
</tr>
<tr>
<td>
<table cellpadding="4" cellspacing="0" width="100%" border="0">
<tr>
<td nowrap="true">
<div id="menu">
<script language="JavaScript">//@@MENU_TOP@@</script>
<div>
<b>Essentials</b>
<div>
<a href="introduction.html">Introduction</a>
</div>
<div>
<a href="integrate.html">Integration Methods</a>
</div>
<div>
<a href="properties.html">Configuration Properties</a>
</div>
<div>
<a href="launch.html">Launching Your Application</a>
</div>
<div>
<b>
                        &gt;&gt;
                        <a href="donate.html">Show Your Support</a>
                        &lt;&lt;
                    </b>
</div>
<div>
<a href="sponsors.html">Sponsors</a>
</div>
</div>
<div>
<b>Documentation</b>
<div>
<a href="jmx.html">JMX Control</a>
</div>
<div>
<a href="security-model.html">Security Model</a>
</div>
<div>
<a href="example.html">Feature Examples</a>
</div>
<div>
<a href="debugging.html">Debugging Your Application</a>
</div>
<div>
<a href="troubleshooting.html">Troubleshooting</a>
</div>
<div>
<a href="faq.html">FAQ</a>
</div>
<div>
<a href="release-notes.html">Release Notes</a>
</div>
<div>
<a href="history.html">Project History</a>
</div>
<div>
<a href="javadocs.html">Javadocs API</a>
</div>
<div>
<a href="buttons.html">Buttons</a>
</div>
<div>
<a href="authors.html">Authors</a>
</div>
<div>
<a href="license.html">License</a>
</div>
</div>
<div>
<b>Download</b>
<div>
<a href="http://sourceforge.net/project/showfiles.php?group_id=39428&package_id=31591">Binaries</a>
</div>
<div>
<a href="http://sourceforge.net/project/showfiles.php?group_id=39428&package_id=33658">Source Code</a>
</div>
</div>
<div>
<b>Get Involved</b>
<div>
<a href="http://sourceforge.net/projects/wrapper/">Source Forge</a>
</div>
<div>
<a href="http://svn.sourceforge.net/viewvc/wrapper/">Subversion Repository</a>
</div>
<div>
<a href="http://sourceforge.net/tracker/?group_id=39428">Issue Tracking</a>
</div>
<div>
<a href="http://sourceforge.net/mail/?group_id=39428">Mailing Lists and Archives</a>
</div>
<div>
<a href="http://sourceforge.net/forum/?group_id=39428">Forums (Old)</a>
</div>
</div>
</div>
<script language="JavaScript">//@@MENU_BOTTOM@@</script>
<p>
<b>Hosted by:</b>
<br>
<a href="http://sourceforge.net/projects/wrapper/"><img alt="SourceForge" border="0" height="31" width="88" src="http://sourceforge.net/sflogo.php?group_id=39428"></a>
<br>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td><td valign="top" width="*">
<table cellpadding="0" cellspacing="0" width="100%" border="0">
<tr>
<td colspan="3"><img height="4" src="images/spacer.gif"></td>
</tr>
<tr>
<td align="center" height="90" colspan="2"><a href="http://wrapper.tanukisoftware.org"><img border="0" height="90" width="728" src="images/OfflineAd728x90.png"></a></td><td rowspan="5"><img width="4" src="images/spacer.gif"></td>
</tr>
<tr>
<td height="49" width="435"><img usemap="#wrapperTitle" border="0" height="49" width="435" src="images/WrapperTitle.png"></td><td valign="bottom" align="right" width="*"><a href="donate.html"><img border="0" height="16" width="300" src="images/DonationRequest.png"></a></td>
</tr>
<tr>
<td height="4" colspan="2"><img height="4" width="500" src="images/BorderTop.png"></td>
</tr>
<tr>
<td colspan="2">
<table cellspacing="0" cellpadding="0" width="100%" border="0">
<tr>
<td valign="top" width="4"><img height="496" width="4" src="images/BorderLeft.png"></td><td bgcolor="#ffffff" valign="top" width="*" colspan="2">
<table cellpadding="4" cellspacing="0" width="100%" border="0">
<tr>
<td nowrap="true" align="center"><font zcolor="#115b77" color="#8888aa" size="5"><b>Environment Variables</b></font></td>
</tr>
<tr>
<td>
<title>Environment Variables</title>
    
    
<a name="N10009"></a>
<table cellpadding="2" cellspacing="0" width="100%" border="0">
<tr>
<td bgcolor="#8888aa" class="sectionheader1" width="*"><font color="#eeeeee" size="4"><b>Configuration Property Overview</b></font></td>
</tr>
<tr>
<td><img height="4" width="1" src="./images/spacer.gif"></td>
</tr>
<tr>
<td>
        
        
<ul>
            
<li>
                
<a href="properties.html">Configuration Property Overview</a>
            
</li>
        
</ul>
    
</td>
</tr>
</table>
    
<a name="N10019"></a>
<table cellpadding="2" cellspacing="0" width="100%" border="0">
<tr>
<td bgcolor="#8888aa" class="sectionheader1" width="*"><font color="#eeeeee" size="4"><b>Working with Environment Variables</b></font></td>
</tr>
<tr>
<td><img height="4" width="1" src="./images/spacer.gif"></td>
</tr>
<tr>
<td>
        
        
<ul>
            
<li>
                
<a href="#expansion">Environment Variable Expansion</a>
            
</li>
            
<li>
                
<a href="#definition">Environment Variable Definition</a>
            
</li>
            
<li>
                
<a href="#default-definitions">Default Environment Variable Definitions</a>
            
</li>
        
</ul>
        
<a name="expansion"></a>
<table cellpadding="2" cellspacing="0" width="100%" border="0">
<tr>
<td rowspan="3" width="10"><img height="1" width="10" src="./images/spacer.gif"></td><td bgcolor="#9999bb" class="sectionheader2" width="*"><font color="#eeeeee" size="3"><b>Environment Variable Expansion</b></font></td>
</tr>
<tr>
<td><img height="4" width="1" src="./images/spacer.gif"></td>
</tr>
<tr>
<td>
            
            
<p>
                The Wrapper supports environment variable expansion at run time
                within the values of any property.  To maintain the platform
                independent nature of the <tt>wrapper.conf</tt>
                file, the windows syntax is used for all platforms.
            </p>
            
<p>
                When the Wrapper is run as a service, environment variables will
                be loaded from the system registry rather than from the
                environment.  This was necessary because Windows loads the
                environment variables which are available to services when the
                machine is booted.  Any changes to the system environment variables
                in the registry (set directly or through the system control panel)
                are not made available to the services until the machine is once
                again rebooted.  By loading the environment variables from the
                registry, the reboot can be avoided while providing the same
                functionality.
            </p>
            
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td class="listingcaption"><i>Example referencing the <tt>JAVA_HOME</tt> environment variable:</i></td>
</tr>
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">wrapper.java.command=%JAVA_HOME%/bin/java</pre>
</font></td>
</tr>
</table>
            
<p>
                This will expand at runtime to a fully qualified path on any
                system which defines the <tt>JAVA_HOME</tt>
                environment variable.
            </p>
            
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td class="listingcaption"><i>Windows:</i></td>
</tr>
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">wrapper.java.command=C:\Sun\jdk1.3/bin/java</pre>
</font></td>
</tr>
</table>
            
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td class="listingcaption"><i>UNIX:</i></td>
</tr>
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">wrapper.java.command=/opt/IBMJava2-131/bin/java</pre>
</font></td>
</tr>
</table>
            
<p>
                If a referenced environment variable is not defined, then it will
                be left unchanged in the property value.
            </p>
        
</td>
</tr>
</table>
        
<a name="definition"></a>
<table cellpadding="2" cellspacing="0" width="100%" border="0">
<tr>
<td rowspan="3" width="10"><img height="1" width="10" src="./images/spacer.gif"></td><td bgcolor="#9999bb" class="sectionheader2" width="*"><font color="#eeeeee" size="3"><b>Environment Variable Definition</b></font></td>
</tr>
<tr>
<td><img height="4" width="1" src="./images/spacer.gif"></td>
</tr>
<tr>
<td>
            
            
<p>
                The Wrapper supports the ability to define environment variables
                from within the <tt>wrapper.conf</tt> file
                or from the command line.  Once defined, the environment variable
                can be referenced like any other environment variable.  This includes
                use in variable expansion as described above.
            </p>
            
<p>
                Environment variables are defined by using special property names which
                begin with <tt>"set."</tt> or
                <tt>"set.default."</tt> followed by the name
                of the environment variable.  The value of the property will be the value
                of the new environment variable.
            </p>
            
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">set.EXTERN_APP=C:/ExternAppHome</pre>
</font></td>
</tr>
</table>
            
<p>
                If the <tt>"set.default."</tt> syntax is used,
                the environment variable will only be set if it does not yet exist.
                This can be useful for defining a series of default environment variable
                values.
            </p>
            
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">set.default.EXTERN_APP=C:/ExternAppHome</pre>
</font></td>
</tr>
</table>
            
<p>
                The ability to define environment variables make it possible to easily
                modify values that may be used throughout a configuration file.  The
                example below shows how an environment variable can be used to specify
                the location of an external application.
            </p>
            
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">set.EXTERN_APP=C:/ExternAppHome

wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=%EXTERN_APP%/lib/jar1.jar
wrapper.java.classpath.3=%EXTERN_APP%/lib/jar2.jar
wrapper.java.classpath.4=%EXTERN_APP%/lib/ext/jar3.jar
wrapper.java.classpath.5=%EXTERN_APP%/lib/ext/jar4.jar</pre>
</font></td>
</tr>
</table>
            
<p>
                The use of environment variables definitions can be very powerful if you
                understand how and when their values are set.  Environment variables which
                were set before the Wrapper is launched can of course be used as usual.
                If the same variable name is specified in the configuration file then
                the value in the configuration file will override the existing value.
            </p>
            
<p>
                Environment variables defined from the command line work a little
                differently.  These values will override any values from either the system
                or those set in the configuration file.  This makes it possible to define
                default environment variables within the <tt>wrapper.conf</tt>
                file and then override that value from the command line.
            </p>
            
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td class="listingcaption"><i>Windows:</i></td>
</tr>
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">Wrapper.exe -c ..\conf\wrapper.conf "set.EXTERN_APP=C:\Program Files\ExternAppHome"</pre>
</font></td>
</tr>
</table>
            
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td class="listingcaption"><i>Unix:</i></td>
</tr>
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">wrapper ../conf/wrapper.conf set.EXTERN_APP=/usr/lib/externapphome</pre>
</font></td>
</tr>
</table>
            
<div class="note">
<table cellspacing="0" cellpadding="2" width="100%" border="0">
<tr>
<td nowrap="nowrap" valign="top">
<p class="notelabel">
<font color="#0000a0"><b>NOTE MEG</b></font>
</p>
</td><td><img width="10" src="images/spacer.gif"></td><td bgcolor="#bbbbdd" class="notebody"><font color="#222260">
                
<p>
                    Notice that like all properties set from the command line, properties
                    which include spaces can be defined by including the entire property name,
                    value pair in quotes.
                </p>
            
</font></td>
</tr>
</table>
</div>
        
</td>
</tr>
</table>
        
<a name="default-definitions"></a>
<table cellpadding="2" cellspacing="0" width="100%" border="0">
<tr>
<td rowspan="3" width="10"><img height="1" width="10" src="./images/spacer.gif"></td><td bgcolor="#9999bb" class="sectionheader2" width="*"><font color="#eeeeee" size="3"><b>Default Environment Variable Definitions</b></font></td>
</tr>
<tr>
<td><img height="4" width="1" src="./images/spacer.gif"></td>
</tr>
<tr>
<td>
            
            
<p>
                On startup, the Wrapper sets the following environment variables into its own
                environment.   These variables can be used within the wrapper.conf file or by
                accessing the environment of the JVM or any of its child processes.
            </p>
            
<ul>
                
<li>
                    
<p>
                        The <tt>WRAPPER_FILE_SEPARATOR</tt> variable is
                        set to '\' on Windows and '/' on UNIX platforms.  The variable can be used
                        to set platform independent values for additional environment variables or
                        properties.
                    </p>
                    
<p>
                        In general it is safe to always use '/' as a file separator for paths used
                        within Java.  Java is designed to work correctly on all platforms when '/'
                        is used.
                    </p>
                
</li>
                
<li>
                    
<p>
                        The <tt>WRAPPER_PATH_SEPARATOR</tt> variable is
                        set to ';' on Windows and ':' on UNIX platforms.  The variable can be
                        used to build up platform independent paths.
                    </p>
                    
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td class="listingcaption"><i>Example:</i></td>
</tr>
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">set.PATH=..%WRAPPER_FILE_SEPARATOR%lib%WRAPPER_PATH_SEPARATOR%%PATH%</pre>
</font></td>
</tr>
</table>
                    
<p>
                        Which resolves to the following:
                    </p>
                    
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td class="listingcaption"><i>Windows:</i></td>
</tr>
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">set.PATH=..\lib;%PATH%</pre>
</font></td>
</tr>
</table>
                    
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td class="listingcaption"><i>UNIX:</i></td>
</tr>
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">set.PATH=../lib:%PATH%</pre>
</font></td>
</tr>
</table>
                
</li>
                
<li>
                    
<p>
                        The <tt>WRAPPER_OS</tt> variable is set to the
                        name of the OS for which the currently running copy of Wrapper was built.
                    </p>
                    
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td class="listingcaption"><i>Example:</i></td>
</tr>
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">wrapper.java.library.path.1=../lib
wrapper.java.library.path.2=../lib/native/%WRAPPER_OS%-%WRAPPER_ARCH%-%WRAPPER_BITS%</pre>
</font></td>
</tr>
</table>
                    
<p>
                        Which resolves to the following:
                    </p>
                    
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td class="listingcaption"><i>Windows:</i></td>
</tr>
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">wrapper.java.library.path.1=../lib
wrapper.java.library.path.2=../lib/native/windows-x86-32</pre>
</font></td>
</tr>
</table>
                    
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td class="listingcaption"><i>Linux:</i></td>
</tr>
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">wrapper.java.library.path.1=../lib
wrapper.java.library.path.2=../lib/native/linux-x86-32</pre>
</font></td>
</tr>
</table>
                    
<table cellspacing="0" cellpadding="0" width="100%" border="0" class="listing">
<tr>
<td class="listingcaption"><i>Solaris:</i></td>
</tr>
<tr>
<td bgcolor="#eeeeee" class="listingcell"><font color="#444444">
<pre class="listingpre">wrapper.java.library.path.1=../lib
wrapper.java.library.path.2=../lib/native/solaris-sparc-32</pre>
</font></td>
</tr>
</table>
                
</li>
                
<li>
                    
<p>
                        The <tt>WRAPPER_ARCH</tt> variable is set to the
                        name of the architecture for which the currently running copy of Wrapper
                        was built.
                    </p>
                
</li>
                
<li>
                    
<p>
                        The <tt>WRAPPER_BITS</tt> variable is set to the
                        32 or 64 bit depth for which the currently running copy of Wrapper was
                        built.
                    </p>
                
</li>
            
</ul>
        
</td>
</tr>
</table>
    
</td>
</tr>
</table>

</td>
</tr>
<tr>
<td align="right" id="author">
<p>
<i>by Leif Mortenson</i>
</p>
</td>
</tr>
</table>
<script language="JavaScript">//@@BODY_SECTION@@</script></td><td valign="bottom" width="4"><img height="496" width="4" src="images/BorderRight.png"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="right" height="4" colspan="2"><img height="4" width="500" src="images/BorderBottom.png"></td>
</tr>
</table>
</td>
</tr>
</table>
<table cellpadding="2" cellspacing="0" border="0" width="100%">
<tr>
<td id="copyright" align="left"><font color="#525D76" size="-1" face="arial,helvetica,sanserif"><i>
                            Copyright &copy;1999-2004 by <a href="http://www.tanukisoftware.com">Tanuki Software</a>.
                            All Rights Reserved.
                        </i></font></td><td align="right"><font color="#525D76" size="-1" face="arial,helvetica,sanserif"><i>
                            last modified:
                            <script language="JavaScript"> document.write(document.lastModified); </script></i></font></td>
</tr>
</table>
</body>
</html>
